#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <xmms/xmmsctrl.h>

//. apparently TRUE and FALSE are defined by xmmsctrl->glib.
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif

#define NUL (0)



#define PROGRAM_VER "v1.07"
#define PROGRAM_DATE "20070426"

//. render switches (psbtfcnlrv)
#define SWITCH_PLAYLIST_POS 112
#define SWITCH_SAMPLERATE 115
#define SWITCH_BITRATE 98
#define SWITCH_TITLE 116
#define SWITCH_FILENAME 102
#define SWITCH_CHANNEL_MODE 99
#define SWITCH_CURRENT_TIME 110
#define SWITCH_SONG_LENGTH 108
#define SWITCH_RUN_STATE 114
#define SWITCH_CURRENT_VOLUME 118

//. render modifier switches (LSQhV)
#define SWITCH_LABELS 76
#define SWITCH_GIVE_SECONDS 83
#define SWITCH_QUOTE_STRINGS 81
#define SWITCH_HELP 104
#define SWITCH_VERSION 86

#define XMMS_SESSION 0

char *empty;

//. query structure.
typedef struct query_structure {
	int pos;
	int length;
	int time;
	int samplerate;
	int bitrate;
	int channels;
	int volume;
	char *title;
	char *file;
} query_s;

//. query functions.
void qxmms(query_s *);
void qxmms_run_state(void);
void qxmms_track_length(void);
void qxmms_current_time(void);
void qxmms_channels(void);
void qxmms_playlist_pos(void);
void qxmms_filename(void);
void qxmms_bitrate(void);
void qxmms_samplerate(void);
void qxmms_title(void);
void qxmms_volume(void);
void qxmms_version(void);
void qxmms_help(void);

//. command functions.
int qxmms_test(void);
int qxmms_process(int, char **);
void qxmms_play(void);
void qxmms_stop(void);
void qxmms_pause(void);
void qxmms_next(void);
void qxmms_prev(void);
void qxmms_addfile(char*);
void qxmms_get_volume(void);
void qxmms_set_volume(char*);
void qxmms_mute(void);
void qxmms_jump_pos(char*);
void qxmms_seek(char *);
void qxmms_skin(char *);

//. command structure.
typedef struct command_structure {
	char name[16];
	void (*func)();
	char value;
} cmd_s;

static cmd_s cmd[] = {
	{ "play", &qxmms_play, 0 },
	{ "stop", &qxmms_stop, 0 },
	{ "pause", &qxmms_pause, 0 },
	{ "next", &qxmms_next, 0 },
	{ "prev", &qxmms_prev, 0 },
	{ "addfile", &qxmms_addfile, 1},
	{ "queue", &qxmms_addfile, 1},
	{ "volume", &qxmms_set_volume, 1 },
	{ "mute", &qxmms_mute, 0 },
	{ "jump", &qxmms_jump_pos, 1 },
	{ "seek", &qxmms_seek, 2 },
	{ "skin", &qxmms_skin, 1 },
	//. go gnu liek lol.
	{ "--version", &qxmms_version, 0 }
};

//. global variables;
int r_labels;
int r_help;
int r_ver;
int r_quotes;	
int p_time;
int s_volume;

query_s q;
